!function(s,n){"use strict";if(s&&s.customize){const i=s.customize;i.SFGuidedTourSteps=[],"undefined"!=typeof _wpCustomizeSFGuidedTourSteps&&n.extend(i.SFGuidedTourSteps,_wpCustomizeSFGuidedTourSteps),i.SFGuidedTour={$container:null,currentStep:-1,init(){this._setupUI()},_setupUI(){const t=this,e=n("body.wp-customizer .wp-full-overlay");this.$container=n("<div/>").addClass("sf-guided-tour"),e.prepend(this.$container),this._addListeners(),this.$container.css(n("body").hasClass("rtl")?"right":"left",n("#customize-controls").width()+10+"px").on("transitionend",function(){t.$container.addClass("sf-loaded")}),this._showNextStep(),n(document).on("click",".sf-guided-tour-step .sf-nux-button",function(){return t._showNextStep(),!1}),n(document).on("click",".sf-guided-tour-step .sf-guided-tour-skip",function(){return 0===t.currentStep?t._hideTour(!0):t._showNextStep(),!1})},_addListeners(){const t=this;i.state("expandedSection").bind(function(){t._adjustPosition()}),i.state("expandedPanel").bind(function(){t._adjustPosition()})},_adjustPosition(){var t,e,s=this._getCurrentStep();s&&(this.$container.removeClass("sf-inside-section"),e=i.state("expandedSection").get(),t=i.state("expandedPanel").get(),e&&s.section===e.id?(this._moveContainer(n(e.container[1]).find(".customize-section-title")),this.$container.addClass("sf-inside-section")):!1===e&&!1===t?this._isTourHidden()?this._revealTour():(e=this._getSelector(s.section),this._moveContainer(e)):this._hideTour())},_hideTour(t){const e=this;var s;this._isTourHidden()||(s=this.$container.offset(),this.$container.css({transform:"",top:s.top}),n("body").addClass("sf-exiting").on("animationend.storefront webkitAnimationEnd.storefront",function(){n(this).removeClass("sf-exiting").off("animationend.storefront webkitAnimationEnd.storefront").addClass("sf-hidden"),e.$container.hide(),void 0!==t&&!0===t&&e._removeTour()}))},_revealTour(){const t=this;n("body").removeClass("sf-hidden"),t.$container.show();var e=this.$container.offset();const s=parseInt(e.top,10);n("body").addClass("sf-entering").on("animationend.storefront webkitAnimationEnd.storefront",function(){n(this).removeClass("sf-entering").off("animationend.storefront webkitAnimationEnd.storefront"),t.$container.css({top:"auto",transform:"translateY("+s+"px)"})})},_removeTour(){this.$container.remove()},_closeAllSections(){i.section.each(function(t){t.collapse({duration:0})}),i.panel.each(function(t){t.collapse({duration:0})})},_showNextStep(){var t,e;this._isLastStep()?this._hideTour(!0):(this._closeAllSections(),(t=this._getNextStep()).message=this._lineBreaksToParagraphs(t.message),e=s.template("sf-guided-tour-step"),this.$container.removeClass("sf-first-step"),0===this.currentStep&&(t.first_step=!0,this.$container.addClass("sf-first-step")),this._isLastStep()&&(t.last_step=!0,this.$container.addClass("sf-last-step")),this._moveContainer(this._getSelector(t.section)),this.$container.html(e(t)))},_moveContainer(t){const e=this;t&&(t=parseInt(t.offset().top,10)+t.height()/2-44,this.$container.addClass("sf-moving").css({transform:"translateY("+t+"px)"}).on("transitionend.storefront",function(){e.$container.removeClass("sf-moving"),e.$container.off("transitionend.storefront")}))},_getSelector(t){var e=i.section(t)?i.section(t):i.panel(t);return n(void 0!==e?e.container[0]:t)},_getCurrentStep(){return i.SFGuidedTourSteps[this.currentStep]},_getNextStep(){return this.currentStep=this.currentStep+1,i.SFGuidedTourSteps[this.currentStep]},_isTourHidden(){return!!n("body").hasClass("sf-hidden")},_isLastStep(){return!(this.currentStep+1<i.SFGuidedTourSteps.length)},_lineBreaksToParagraphs(t){return"<p>"+t.replace("\n\n","</p><p>")+"</p>"}},n(document).ready(function(){i.SFGuidedTour.init()})}}(window.wp,jQuery);
